<template id="temp">
  <!-- vue实例外创建 -->
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>系统首页</el-breadcrumb-item>
    </el-breadcrumb>
    <div style="height: 60px"></div>

    <el-row :gutter="60">
      <el-col :span="8" v-if="roleid == 3 || roleid == 1"
        ><div class="grid-content bg-purple">
          <el-card class="box-card">
            <el-row>
              <el-col :span="8">
                <svg
                  t="1655199779195"
                  class="icon"
                  viewBox="0 0 1024 1024"
                  version="1.1"
                  xmlns="http://www.w3.org/2000/svg"
                  p-id="2473"
                  width="48"
                  height="48"
                >
                  <path
                    d="M85.333333 85.546667A85.525333 85.525333 0 0 1 170.666667 0h682.666666c47.146667 0 85.333333 38.272 85.333334 85.546667V1024l-160.64-106.666667-135.125334 106.666667-129.813333-106.666667-132.458667 106.666667-138.624-106.666667L85.333333 1024V85.546667z m85.333334 63.765333V879.36l92.672-79.658667 117.290666 91.690667 132.458667-91.690667 129.813333 91.690667 113.792-91.690667L853.333333 879.36V149.333333A64 64 0 0 0 789.418667 85.333333H234.581333A63.850667 63.850667 0 0 0 170.666667 149.312zM256 256c0-23.573333 19.136-42.666667 42.773333-42.666667h426.453334c23.616 0 42.773333 18.944 42.773333 42.666667 0 23.573333-19.136 42.666667-42.773333 42.666667h-426.453334A42.624 42.624 0 0 1 256 256z m0 192c0-23.573333 19.136-42.666667 42.773333-42.666667h426.453334c23.616 0 42.773333 18.944 42.773333 42.666667 0 23.573333-19.136 42.666667-42.773333 42.666667h-426.453334A42.624 42.624 0 0 1 256 448z m0 192c0-23.573333 19.136-42.666667 42.773333-42.666667h426.453334c23.616 0 42.773333 18.944 42.773333 42.666667 0 23.573333-19.136 42.666667-42.773333 42.666667h-426.453334A42.624 42.624 0 0 1 256 640z"
                    p-id="2474"
                    fill="#1ccb89"
                  ></path></svg
              ></el-col>
              <el-col :span="8">
                <label>累计开单</label>
                <div
                  style="margin-top: 10px; font-weight: bold; font-size: 20px"
                >
                  {{ chainNum }}单
                </div>
              </el-col>
              <el-col :span="8" style="text-align: center; margin-top: 10px">
                <el-badge class="item">
                  <el-button size="small" @click="chain()">查看</el-button>
                </el-badge>
              </el-col>
            </el-row>
          </el-card>
        </div></el-col
      >
      <el-col :span="8" v-if="roleid == 3 || roleid == 1">
        <div class="grid-content bg-purple">
          <el-card class="box-card">
            <el-row>
              <el-col :span="8">
                <svg
                  t="1655199828318"
                  class="icon"
                  viewBox="0 0 1024 1024"
                  version="1.1"
                  xmlns="http://www.w3.org/2000/svg"
                  p-id="2724"
                  width="48"
                  height="48"
                >
                  <path
                    d="M860.8 73.6v802.4l-40-30.4-44-34.4-44 34.4-82.4 64.8-107.2-69.6-44-28.8-40.8 32.8-79.2 64-86.4-64.8-42.4-32-43.2 32-43.2 32V73.6h696.8m72-72H91.2v1015.2l157.6-116L380.8 1000 504 900.8l150.4 97.6 123.2-96.8 156 120V1.6h-0.8z"
                    p-id="2725"
                    fill="#1ccb89"
                  ></path>
                  <path
                    d="M202.4 693.6h20.8v48.8h-20.8zM492 693.6h38.4v48.8h-38.4zM568.8 693.6h38.4v48.8h-38.4zM645.6 693.6h38.4v48.8h-38.4zM415.2 693.6h38.4v48.8h-38.4zM338.4 693.6h38.4v48.8h-38.4zM261.6 693.6h38.4v48.8h-38.4zM722.4 693.6h38.4v48.8h-38.4zM799.2 693.6h20.8v48.8h-20.8zM478.4 600.8h70.4V492h132.8v-69.6H548.8v-44h132.8v-68.8h-112L664 196.8l-45.6-40.8L512 278.4 405.6 156 360 196.8l95.2 112.8H342.4v68.8h136v44h-136v69.6h136z"
                    p-id="2726"
                    fill="#1ccb89"
                  ></path></svg
              ></el-col>
              <el-col :span="8">
                <label>累计开单总额</label>
                <div
                  style="margin-top: 10px; font-weight: bold; font-size: 20px"
                >
                  {{ total }}元
                </div>
              </el-col>
              <el-col :span="8" style="text-align: center; margin-top: 10px">
                <el-badge class="item">
                  <el-button size="small" @click="chain()">查看</el-button>
                </el-badge>
              </el-col>
            </el-row>
          </el-card>
        </div>
      </el-col>
      <el-col :span="8" v-if="roleid == 3 || roleid == 1">
        <div class="grid-content bg-purple">
          <el-card class="box-card">
            <el-row>
              <el-col :span="8">
                <svg
                  t="1655200356652"
                  class="icon"
                  viewBox="0 0 1024 1024"
                  version="1.1"
                  xmlns="http://www.w3.org/2000/svg"
                  p-id="4649"
                  width="48"
                  height="48"
                >
                  <path
                    d="M669.215131 636.860702a30.104144 30.104144 0 0 0-12.64374-40.640595 448.250711 448.250711 0 0 0-71.647864-30.104144 301.041445 301.041445 0 1 0-285.38729 0A425.07052 425.07052 0 0 0 0 965.899001a30.104144 30.104144 0 1 0 60.208289 0c0-199.590478 171.593623-361.249734 382.322635-361.249733a398.879914 398.879914 0 0 1 186.043612 45.758299 30.104144 30.104144 0 0 0 40.640595-13.546865zM201.998809 301.500533a240.833156 240.833156 0 1 1 240.833156 240.833156 240.833156 240.833156 0 0 1-240.833156-240.833156zM1023.540912 990.885441l-90.312434-90.312433a165.873836 165.873836 0 1 0-33.716641 33.114559l90.312433 90.312433z m-331.145589-188.752986a105.364506 105.364506 0 1 1 105.364505 105.364506 105.364506 105.364506 0 0 1-105.364505-105.364506z"
                    fill="#1ccb89"
                    p-id="4650"
                  ></path></svg
              ></el-col>
              <el-col :span="8">
                <label>开单复审</label>
                <div
                  style="margin-top: 10px; font-weight: bold; font-size: 20px"
                >
                  {{ checkNum }}
                </div>
              </el-col>
              <el-col :span="8" style="text-align: center; margin-top: 10px">
                <el-badge :value="checkNum" class="item">
                  <el-button size="small" @click="check()">查看</el-button>
                </el-badge>
              </el-col>
            </el-row>
          </el-card>
        </div>
      </el-col>
    </el-row>
    <div style="height: 60px"></div>
    <el-row :gutter="60">
      <el-col :span="8">
        <div class="grid-content bg-purple">
          <el-card class="box-card">
            <el-row>
              <el-col :span="8">
                <svg
                  t="1655200784136"
                  class="icon"
                  viewBox="0 0 1024 1024"
                  version="1.1"
                  xmlns="http://www.w3.org/2000/svg"
                  p-id="6616"
                  width="48"
                  height="48"
                >
                  <path
                    d="M511.5 575.617c-75.605 0-146.685-29.442-200.145-82.903-53.461-53.461-82.903-124.54-82.903-200.145s29.442-146.684 82.903-200.145c53.46-53.46 124.54-82.902 200.145-82.902s146.684 29.442 200.145 82.902c53.46 53.461 82.902 124.54 82.902 200.145s-29.442 146.685-82.902 200.145c-53.461 53.461-124.541 82.903-200.145 82.903z m0-502.095c-120.784 0-219.048 98.264-219.048 219.047S390.716 511.617 511.5 511.617c120.783 0 219.047-98.265 219.047-219.048S632.282 73.522 511.5 73.522zM73 1021c-17.673 0-32-14.327-32-32 0-63.165 12.378-124.459 36.791-182.177 23.573-55.732 57.313-105.779 100.283-148.749s93.017-76.71 148.75-100.283C384.542 533.378 445.834 521 509 521c75.987 0 151.447 18.636 218.223 53.893 15.629 8.252 21.609 27.61 13.357 43.238-8.253 15.629-27.612 21.607-43.239 13.357C639.74 601.075 574.612 585 509 585c-222.767 0-404 181.233-404 404 0 17.673-14.327 32-32 32z m899.866-169.645H690.838c-17.673 0-32-14.327-32-32s14.327-32 32-32h282.028c17.673 0 32 14.327 32 32s-14.327 32-32 32zM831.853 992.37c-17.673 0-32-14.327-32-32V678.342c0-17.673 14.327-32 32-32s32 14.327 32 32V960.37c0 17.673-14.328 32-32 32z"
                    fill="#1ccb89"
                    p-id="6617"
                  ></path></svg
              ></el-col>
              <el-col :span="8">
                <label>邀请确认</label>
                <div
                  style="margin-top: 10px; font-weight: bold; font-size: 20px"
                >
                  {{ inviteNum }}
                </div>
              </el-col>
              <el-col :span="8" style="text-align: center; margin-top: 10px">
                <el-badge :value="inviteNum" class="item">
                  <el-button size="small" @click="invite()">查看</el-button>
                </el-badge>
              </el-col>
            </el-row>
          </el-card>
        </div>
      </el-col>
      <el-col :span="8">
        <div class="grid-content bg-purple">
          <el-card class="box-card">
            <el-row>
              <el-col :span="8">
                <svg
                  t="1655200852005"
                  class="icon"
                  viewBox="0 0 1024 1024"
                  version="1.1"
                  xmlns="http://www.w3.org/2000/svg"
                  p-id="9677"
                  width="48"
                  height="48"
                >
                  <path
                    d="M512 64c249.6 0 448 198.4 448 448s-198.4 448-448 448-448-198.4-448-448 198.4-448 448-448z m0 64C300.8 128 128 300.8 128 512s172.8 384 384 384 384-172.8 384-384-172.8-384-384-384zM377.6 256L512 390.4 646.4 256l44.8 44.8L544 448h128v64h-128v64h128v64h-128v128h-64v-128h-128V576h128V512h-128V448h128L332.8 300.8l44.8-44.8z"
                    p-id="9678"
                    fill="#1ccb89"
                  ></path></svg
              ></el-col>
              <el-col :span="8">
                <label>链单待还款</label>
                <div
                  style="margin-top: 10px; font-weight: bold; font-size: 20px"
                >
                  {{ payMoney }}元
                </div>
              </el-col>
              <el-col :span="8" style="text-align: center; margin-top: 10px">
                <el-badge :value="payNum" class="item">
                  <el-button size="small" @click="pay()">查看</el-button>
                </el-badge>
              </el-col>
            </el-row>
          </el-card>
        </div>
      </el-col>
      <el-col :span="8">
        <div class="grid-content bg-purple">
          <el-card class="box-card">
            <el-row>
              <el-col :span="8">
                <svg
                  t="1655200852005"
                  class="icon"
                  viewBox="0 0 1024 1024"
                  version="1.1"
                  xmlns="http://www.w3.org/2000/svg"
                  p-id="9677"
                  width="48"
                  height="48"
                >
                  <path
                    d="M512 64c249.6 0 448 198.4 448 448s-198.4 448-448 448-448-198.4-448-448 198.4-448 448-448z m0 64C300.8 128 128 300.8 128 512s172.8 384 384 384 384-172.8 384-384-172.8-384-384-384zM377.6 256L512 390.4 646.4 256l44.8 44.8L544 448h128v64h-128v64h128v64h-128v128h-64v-128h-128V576h128V512h-128V448h128L332.8 300.8l44.8-44.8z"
                    p-id="9678"
                    fill="#1ccb89"
                  ></path></svg
              ></el-col>
              <el-col :span="8">
                <label>手续费待还款</label>
                <div
                  style="margin-top: 10px; font-weight: bold; font-size: 20px"
                >
                  {{ serviceMoney }}
                </div>
              </el-col>
              <el-col :span="8" style="text-align: center; margin-top: 10px">
                <el-badge :value="serviceNum" class="item">
                  <el-button size="small" @click="pay()">查看</el-button>
                </el-badge>
              </el-col>
            </el-row>
          </el-card>
        </div>
      </el-col>
    </el-row>
    <div style="height: 60px"></div>
    <el-row :gutter="60">
      <el-col :span="8">
        <div class="grid-content bg-purple">
          <el-card class="box-card">
            <el-row>
              <el-col :span="8">
                <svg
                  t="1655200852005"
                  class="icon"
                  viewBox="0 0 1024 1024"
                  version="1.1"
                  xmlns="http://www.w3.org/2000/svg"
                  p-id="9677"
                  width="48"
                  height="48"
                >
                  <path
                    d="M512 64c249.6 0 448 198.4 448 448s-198.4 448-448 448-448-198.4-448-448 198.4-448 448-448z m0 64C300.8 128 128 300.8 128 512s172.8 384 384 384 384-172.8 384-384-172.8-384-384-384zM377.6 256L512 390.4 646.4 256l44.8 44.8L544 448h128v64h-128v64h128v64h-128v128h-64v-128h-128V576h128V512h-128V448h128L332.8 300.8l44.8-44.8z"
                    p-id="9678"
                    fill="#1ccb89"
                  ></path></svg
              ></el-col>
              <el-col :span="8">
                <label>利息待还款</label>
                <div
                  style="margin-top: 10px; font-weight: bold; font-size: 20px"
                >
                  {{ interestMoney }}元
                </div>
              </el-col>
              <el-col :span="8" style="text-align: center; margin-top: 10px">
                <el-badge :value="interestNum" class="item">
                  <el-button size="small" @click="pay()">查看</el-button>
                </el-badge>
              </el-col>
            </el-row>
          </el-card>
        </div>
      </el-col>
      <el-col :span="8">
        <div class="grid-content bg-purple">
          <el-card class="box-card">
            <el-row>
              <el-col :span="8">
                <svg
                  t="1655200852005"
                  class="icon"
                  viewBox="0 0 1024 1024"
                  version="1.1"
                  xmlns="http://www.w3.org/2000/svg"
                  p-id="9677"
                  width="48"
                  height="48"
                >
                  <path
                    d="M512 64c249.6 0 448 198.4 448 448s-198.4 448-448 448-448-198.4-448-448 198.4-448 448-448z m0 64C300.8 128 128 300.8 128 512s172.8 384 384 384 384-172.8 384-384-172.8-384-384-384zM377.6 256L512 390.4 646.4 256l44.8 44.8L544 448h128v64h-128v64h128v64h-128v128h-64v-128h-128V576h128V512h-128V448h128L332.8 300.8l44.8-44.8z"
                    p-id="9678"
                    fill="#1ccb89"
                  ></path></svg
              ></el-col>
              <el-col :span="8">
                <label>服务费待还款</label>
                <div
                  style="margin-top: 10px; font-weight: bold; font-size: 20px"
                >
                  1000
                </div>
              </el-col>
              <el-col :span="8" style="text-align: center; margin-top: 10px">
                <el-badge :value="12" class="item">
                  <el-button size="small" @click="pay()">查看</el-button>
                </el-badge>
              </el-col>
            </el-row>
          </el-card>
        </div>
      </el-col>
    </el-row>
    <div style="text-align: center; margin-top: 240px">
      <p>Copyright © 企业中文名称, All Rights Reserved.</p>
      <p>备案号</p>
      <p>服务热线：xxx-xxxx-xxx</p>
    </div>
  </div>
</template>
<script>
import switchOne from '../../components/switchOne.vue'
import Pagination from '../../components/Pagination'
export default {
  data() {
    return {
      interestNum: "",
      interestMoney: "",
      serviceNum: "",
      serviceMoney: "",
      payNum: "",
      payMoney: "",
      inviteNum: "",
      total: "",
      chainNum: "",
      roleid: "",
      checkNum: "",
      formInline: {
        enterprise_id: ""
      },
      checkData: {
        status: -1,
        enterprise_id: "",
        status_tab: "链单开单录入"
      },
      inviteData: {
        eid: ""
      }
    }
  },
  // 注册组件
  components: {
    Pagination,
    switchOne
  },

  /**
   * 创建完毕
   */
  created() {
    this.roleid = JSON.parse(localStorage.getItem("userdata")).role_id;
    this.formInline.enterprise_id = JSON.parse(localStorage.getItem("userdata")).enterprise_id;
    this.checkData.enterprise_id = JSON.parse(localStorage.getItem("userdata")).enterprise_id;
    this.inviteData.eid = JSON.parse(localStorage.getItem("userdata")).enterprise_id;
    this.getdata()
  },

  /**
   * 里面的方法只有被调用才会执行
   */
  methods: {
    pay() {
      this.$router.push({ path: '/loan/manageLoan' })

    },
    chain() {
      this.$router.push({ path: '/chain/query' })
    },
    check() {
      this.$router.push({ path: '/chain/recheck' })
    },
    invite() {
      this.$router.push({ path: '/supply/invite' })
    },

    getdata() {
      this.loading = true
      //查询链单数量
      this.$axios.post('/api/chain/search/', this.formInline)
        .then(res => {
          console.log(res);
          this.loading = false
          if (res.data.code == 200) {
            this.chainNum = res.data.data.total
          }
        }),
        //查询链单总金额
        this.$axios.post('/api/chain/total/', this.formInline)
          .then(res => {
            console.log(res);
            this.loading = false
            if (res.data.code == 200) {
              this.total = res.data.data
            }
          }),
        //查询待审核链单数量
        this.$axios.post('/api/chain/search/', this.checkData)
          .then(res => {
            console.log(res);
            this.loading = false
            if (res.data.code == 200) {
              this.checkNum = res.data.data.total
            }
          }),
        //查询待邀请数量
        this.$axios.post('/api/supply/findAllInvite/', this.inviteData)
          .then(res => {
            console.log(res);
            if (res.data.code == 200) {
              this.inviteNum = res.data.data.total
            }
          }),
        //查询链单还款
        this.$axios.get('/api/loan/getPrincipalData/' + this.formInline.enterprise_id)
          .then(res => {
            console.log(res.data.data);

            this.payNum = res.data.data.count
            this.payMoney = res.data.data.totalMoney

          }),
        //查询手续费
        this.$axios.get('/api/loan/getServiceData/' + this.formInline.enterprise_id)
          .then(res => {
            console.log(res);
            this.serviceNum = res.data.data.count
            this.serviceMoney = res.data.data.totalMoney
          }),
        //查询利息
        this.$axios.get('/api/loan/getInterestData/' + this.formInline.enterprise_id)
          .then(res => {
            console.log(res);
            this.interestNum = res.data.data.count
            this.interestMoney = res.data.data.totalMoney
          })

    },


  }
}
</script>

<style scoped>
</style>
